<?php
namespace Api\Controller;
use Think\Controller;
class UpFileController extends Controller {
    //app用的BASE64 上传
    public function AppUpImg(){
       $img=I('imgs');
       array_pop($img);
       if(!empty($img)){
            $address='Uploads/tem/see/'.date('Y-m-d',time()).'/';
            $_POST['see_pic']=allImg($img,$address);
            $imgs=$_POST['see_pic'];
            $wenjiadate=date('Y-m-d');
            $arr_address_all='./Uploads/see/'.$wenjiadate.'/'.'min'.'/';
            $arr_address_all_min='./Uploads/see/'.$wenjiadate.'/'.'min_min'.'/';
            $array_img_min=img_big_min($_POST['see_pic'],'|',350,350,$arr_address_all);
            $array_img_min_img=img_big_min($_POST['see_pic'],'|',170,170,$arr_address_all_min);
            $_POST['see_pic']=$_POST['see_pic'].'|';
            $_POST['see_pic_min']=$array_img_min;
            $_POST['see_pic_min_min']=$array_img_min_img;
         }
    }
    //小程序file上传
    public function FileUpImg(){
            $upload = new \Think\Upload();// 实例化上传类
            $upload->maxSize   =     31457280 ;// 设置附件上传大小
            $upload->exts      =     array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
            $upload->rootPath  =     './Public/tem/images/'; // 设置附件上传根目录
            $upload->savePath  =     ''; // 设置附件上传（子）目录
            $upload->autoSub   = false;
            // 上传文件 
            $info   =   $upload->upload();
            if(!$info) {// 上传错误提示错误信息
                $this->error($upload->getError());
            }else{// 上传成功
                $imagesRoth=C('HOST_URL')."Public/tem/images/".$info['fileData']['savename'];
                EchoData($imagesRoth);
            }
    }


    //多图上传
    public function ManyImgUp(){
        $arrayurl=FunctionManyImgUp($_FILES);
    }
}